package com.realdtech.wechat.task.Service;

import com.realdtech.wechat.task.model.UserCompany;

import java.util.Date;
import java.util.List;

/**
 * Created by Administrator on 2017/9/19.
 */
public class UserCompanyService {
    private static final UserCompany dao=new UserCompany().dao();

    /**
     *  保存企业注册信息
     * @param company 公司名称
     * @param name  名字
     * @param email 邮箱
     * @param phone 手机
     */
    public void add(String company,String name,String email,String phone){

        UserCompany userCompany=new UserCompany();

        userCompany.setCompany(company);
        userCompany.setName(name);
        userCompany.setEmail(email);
        userCompany.setPhone(phone);
        userCompany.setDate(new Date());

        userCompany.save();
    }

    /**
     * 查询企业表
     */
    public List<UserCompany> find(){

        return dao.find("SELECT * from user_company  order by id desc");
    }
}
